#include "timer.h"

int time_tick;
int sec_tick; 

void timer_init(int timer, int mode){
	int t = timer << 6;
	int result = t | mode;
	outportb(TIMER_CTRL, result);
}

void timer_load(int timer, int value){
	switch(timer){
		case 0: timer = TIMER_0; break;
		case 1: timer = TIMER_1; break;
		case 2: timer = TIMER_2; break;
		default: timer = TIMER_0; break;
	}
	outportb(timer, LSB(value));
	outportb(timer, MSB(value));
}

void mili_sleep(int mili){
	int time0 = time_tick + mili;
	while(time_tick < time0){
		//nao fazer nada
	}
}

void sec_sleep(int secs){
	int time0 = sec_tick + secs;
	while(sec_tick < time0){
		//nao fazer nada
	}
}

